<template>
  <laker-dialog
    v-model="visible"
    title="检查表"
    width="900"
    height="900"
    :show-fullscreen="true"
    :show-close="true"
    destroy-on-close
    @closed="$emit('closed')"
  >
    <table class="laker-table">
      <tr>
        <th style="width: 30px">序号</th>
        <th>作业任务描述</th>
        <th>控制措施</th>
        <th style="width: 50px">风险等级</th>
      </tr>
      <tr v-for="(item, index) in safeCheckList" :key="index">
        <td>{{ index + 1 }}</td>
        <td>{{ item.taskName }}</td>
        <td>{{ item.taskDsc }}</td>
        <td :class="item.fxdj">{{ item.fxdjName }}</td>
      </tr>
    </table>
  </laker-dialog>
</template>

<script>
import LakerDialog from '@/components/lakerDialog/index.vue'
import { dayjs } from 'element-plus'
import dprevent from '@/api/dprevent'

export default {
  name: 'SafeCheckTable',
  components: { LakerDialog },
  emits: ['success', 'closed'],
  data() {
    return {
      dialog: {
        raDialog: false
      },
      mode: 'add',
      visible: false,
      titleMap: {
        add: '选择设备类型',
        edit: '编辑人员',
        show: '查看'
      },
      elmain: 'elmain',
      today: dayjs().format('YYYY-MM-DD'),
      risk01: 0,
      safeCheckList: []
    }
  },
  mounted() {
    this.getApiData()
  },
  methods: {
    getApiData() {
      dprevent.getSafeCheckTable().then((res) => {
        if (res.code === 'success') {
          if (res.result) {
            this.safeCheckList = res.result
          }
        }
      })
    },
    //显示
    open(mode = 'add') {
      this.mode = mode
      this.visible = true
      console.log(this.visible)
      return this
    },
    close() {
      this.visible = false
      return this
    },
    //表单注入数据
    setData(data) {
      console.log(data)
    }
  }
}
</script>

<style scoped lang="scss"></style>
